package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by windo on 16/8/4.
 */
public class WanshanziliaoTask extends CouponHttpBaseTask{
    private String mSchool;
    private String mGrade;
    private String mClassName;
    private String mRealNmae;
    private String mSex;
    private String mNickName;
    private String mUserSign;
    private String mShenfen;
    private String mKemu;


    public WanshanziliaoTask(String school,String shenfen,String grade,String kemu,String real,String sex,String nickName,String userSign) {
        mSchool = school;
        mGrade = grade;
//        mClassName = classname;
        mRealNmae = real;
        mSex = sex;
        mNickName = nickName;
        mUserSign = userSign;
        mShenfen = shenfen;
        mKemu = kemu;
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT){
            CouponHttpRequest request = new CouponHttpRequest();
            request.setApiNo(ApiNo.WANSHANZILIAO);
            JSONObject jsonObject  = new JSONObject();
            jsonObject.put("schoolName",mSchool);
            jsonObject.put("userType",mShenfen);
            jsonObject.put("belongGrade",mGrade);
            jsonObject.put("subject",mKemu);
            jsonObject.put("trueName",mRealNmae);
            jsonObject.put("sex",mSex);
            jsonObject.put("nickName",mNickName);
            jsonObject.put("userSign",mUserSign);
//            jsonObject.put("className",mClassName);
            request.setData(jsonObject.toString());
            addRequest(request);
        }
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS,null);
    }
}
